1. Technical Field
The present invention relates in general to a method and system for data processing and in particular to method and system for controlling the allocation of a shared resource in a multitasking data processing system. Still more particularly, the present invention relates to a multitasking data processing system and method of controlling the allocation of shared resources, which penalize tasks that request more than an allocated amount of a shared resource.
2. Description of the Related Art
Multitasking data processing systems, that is, data processing systems operating under the control of a multitasking operating system, subdivide the work to be accomplished by each application into multiple tasks (or threads). The multiple tasks are each allotted a small quantum of processing time, for example, according to task priority or in round robin fashion, thereby creating the appearance that the multiple tasks are executing concurrently. Conventionally, the tasks comprising an application are corporately allocated a limited set of shared resources, which are accessible to each task and include, for example, dynamic memory. Although judicious apportionment of the shared resources among the multiple tasks is required for efficient operation of the application, executing tasks are often permitted to request and obtain any available portion of the shared resources up to and including all remaining resources. Additional requests for shared resources made after the shared resources are fully allocated simply fail or are answered with error messages, thereby depriving other tasks of critical resources. Thus, the overuse of shared resources by one task can potentially deprive all other tasks of needed resources, resulting in the failure of the other tasks or incomplete and unrecoverable work. This problem is compounded by the fact that current processing speeds permit a task to consume the available shared resources too quickly for a human operator to intervene and reallocate the shared resources.
As should thus be apparent, an improved method for automatically controlling the allocation of shared resources in a multitasking data processing system is needed that prevents tasks from overusing shared resources.
It is therefore one object of the present invention to provide a method and system for data processing.
It is another object of the present invention to provide a method and system for controlling the allocation of a shared resource in a multitasking data processing system.
It is yet another object of the present invention to provide a multitasking data processing system and method of controlling the allocation of shared resources, which penalize tasks that request more than an allocated amount of a shared resource.
The foregoing objects are achieved as is now described. A multitasking data processing system having a plurality of tasks and a shared resource and a method of controlling allocation of shared resources within a multitasking data processing system are provided. In response to a resource request for a portion of a shared resource by a particular task among the plurality of tasks, a determination is made whether or not granting the resource request would cause a selected level of resource allocation to be exceeded. In response to a determination that granting the resource request would not cause the selected level of resource allocation to be exceeded, the resource request is granted. However, in response to a determination that granting the resource request would cause the selected level of resource allocation to be exceeded, execution of the particular task is suspended for a selected penalty time. In one embodiment of the present invention, the shared resource is a memory.
The above as well as additional objects, features, and advantages of the present invention will become apparent in the following detailed written description.